package com.tl.boot.controller;

import com.tl.boot.common.annotation.RestControllerRequstMapping;
import com.tl.boot.common.vo.ResponseVO;
import com.tl.boot.entity.common.form.NeedUIdCommonForm;
import com.tl.boot.entity.user.vo.BaseInfoVO;
import com.tl.boot.service.user.UserService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * com.tl.boot.controller -- MineController
 * Description:
 * Created by joshua_liu <a href="mailto:joshualwork@163.com"></a>
 * On 2019/10/28 9:01
 */
@RestControllerRequstMapping("auth/mine")
public class MineController {

    @Autowired
    private UserService userService;

    @PostMapping("/baseInfo")
    @ApiOperation( value = "获取当前用户基本信息", notes = "-" )
    @ApiImplicitParams( {
            @ApiImplicitParam( name = "form", value = "基础请求对象", required = true,
                    dataType = "NeedUIdCommonForm", paramType = "body" ),
            @ApiImplicitParam( name = "token", value = "鉴权token", required = true, dataType = "String", paramType = "header" ),
    } )
    public ResponseVO<BaseInfoVO> myBaseInfo(@RequestBody NeedUIdCommonForm form) {
        BaseInfoVO vo = userService.getBaseInfo(form.getUserId());
        return ResponseVO.buildSuccess(vo);
    }

}
